import request from '@/utils/request'

let baseMapping = "/course_service/subject/";

export default {

  //课程分类列表
  getList(current, limit) {
    return request({
      url: baseMapping + `getSubject/${current}/${limit}`,
      method: 'get'
    })
  },

  //通过id获取分类信息
  getSubject(id) {
    return request({
      url: baseMapping + `getSubjectById/${id}`,
      method: 'get'
    })
  },

  //修改课程分类
  update(subject) {
    return request({
      url: baseMapping + `updateSubject`,
      method: 'post',
      data: subject
    })
  },

  //添加课程分类
  add(title) {
    return request({
      url: baseMapping + `addSubject/${title}`,
      method: 'get'
    })
  },

  //删除分类
  delete(id) {
    return request({
      url: baseMapping + `deleteSubject/${id}`,
      method: 'get'
    })
  },

  //获取所有分类
  getAllSubject(){
    return request({
      url: baseMapping + `getAllSubject`,
      method: 'get'
    })
  }
}
